package com.example.actearly_revised;


import android.app.Activity;
import android.content.Intent;
import android.text.Html;

/**
 * Starts an Android email intent.
 * The activity, subject, and bodyText fields are required.
 * You can pass a null field for the chooserTitle, to, cc, and bcc fields if 
 * you don't want to specify them.
 */
public class Email{

	public static void emailResultsToUser(Activity activity, String subject,
			String bodyText,
			String chooserTitle,
			String[] toRecipients,
			String[] ccRecipients,
			String[] bccRecipients) {
		Intent mailIntent = new Intent();
		mailIntent.setAction(Intent.ACTION_SEND);
		mailIntent.setType("text/html");
		mailIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
		mailIntent.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(bodyText));

		
		if (toRecipients != null) {
			mailIntent.putExtra(Intent.EXTRA_EMAIL, toRecipients);
		}
		if (ccRecipients != null) {
			mailIntent.putExtra(Intent.EXTRA_CC, ccRecipients);
		}
		if (bccRecipients != null) {
			mailIntent.putExtra(Intent.EXTRA_BCC, bccRecipients);
		}
		if (chooserTitle==null) chooserTitle = "Send Email";
		activity.startActivity(Intent.createChooser(mailIntent, chooserTitle));
	}
}